GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 233ba8...e53afc )
by Florian
06:44
created

ui.js ➔ showWhatsnewDialog   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ui.js ➔ ... ➔ $.getJSON(ꞌwhatsnew.jsonꞌ) 0 10 2
1
/*jslint
2
  indent: 4
3
*/
4
5
/*global
6
  $, document, window, gapi, setTimeout,
7
  CDDA, Coordinates, Freifunk, Hillshading, Lang, NPA, Okapi, Sidebar, Persist,
8
  DownloadGPX, Geolocation,
9
  showMulticoordinatesDialog, Markers
10
*/
11
12
13
/* coordinate format */
14
function setCoordinatesFormat(t) {
15
    'use strict';
16
17
    Persist.setValue('coordinatesFormat', t);
18
19
    if ($('#coordinatesFormat').val() !== t) {
20
        $('#coordinatesFormat').val(t);
21
    }
22
23
    Coordinates.setFormat(t);
24
    Markers.update();
25
}
26
27
28
function restoreCoordinatesFormat(defaultValue) {
29
    'use strict';
30
31
    var t = Persist.getValue("coordinatesFormat", "DM");
32
33
    if (t === "DM" || t === "DMS" || t === "D") {
34
        setCoordinatesFormat(t);
35
    } else {
36
        setCoordinatesFormat(defaultValue);
37
    }
38
}
39
40
41
/* info dialog */
42
function showInfoDialog() {
43
    'use strict';
44
45
    $('#dlgInfo').modal({show: true, backdrop: "static", keyboard: true});
46
}
47
48
49
function showWhatsnewDialog() {
50
    'use strict';
51
52
    $.getJSON("whatsnew.json", function (json) {
53
        var i,
54
            obj;
55
        $('#dlgWhatsnewList').empty();
56
        for (i = 0; i < json.length; i += 1) {
57
            obj = json[i];
58
            $('#dlgWhatsnewList').append("<li>" + obj.date + ": " + obj.text + "</li>");
59
        }
60
        $('#dlgWhatsnew').modal({show: true, backdrop: "static", keyboard: true});
61
    });
62
}
63
64
65
/* alert dialog */
66
function showAlert(title, msg) {
67
    'use strict';
68
69
    $("#dlgAlertHeader").html(title);
70
    $("#dlgAlertMessage").html(msg);
71
    $("#dlgAlert").modal({show: true, backdrop: "static", keyboard: true});
72
}
73
74
75
/* projection dialog */
76
function showProjectionDialog(callback) {
77
    'use strict';
78
79
    $('#projectionDialogOk').off('click');
80
    $('#projectionDialogOk').click(function () {
81
        $('body').removeClass('modal-open');
82
        $('.modal-backdrop').remove();
83
        $('#projectionDialog').modal('hide');
84
        if (callback) {
85
            setTimeout(function () {
86
                callback($("#projectionBearing").val(), $("#projectionDistance").val());
87
            }, 10);
88
        }
89
    });
90
    $("#projectionDialog").modal({show: true, backdrop: "static", keyboard: true});
91
}
92
93
94
/* permalink dialog */
95
function showLinkDialog(linkUrl) {
96
    'use strict';
97
98
    var length = linkUrl.length;
99
100
    $('#linkDialogLink').val(linkUrl);
101
    if (length >= 4096) {
102
        $('#linkDialogLengthMessage').html(Lang.t("dialog.permalink.length").replace(/%1/, length));
103
    } else {
104
        $('#linkDialogLengthMessage').html('');
105
    }
106
    $('#linkDialogError').html('');
107
108
    $('#linkDialog').modal({show: true, backdrop: "static", keyboard: true});
109
    $('#linkDialogLink').select();
110
}
111
112
113
function linkDialogShortenLink() {
114
    'use strict';
115
116
    var longUrl = $('#linkDialogLink').val();
117
    $('#linkDialogError').html('');
118
    gapi.client.setApiKey('AIzaSyC_KjqwiB6tKCcrq2aa8B3z-c7wNN8CTA0');
119
    gapi.client.load('urlshortener', 'v1', function () {
120
        var request = gapi.client.urlshortener.url.insert({resource: {longUrl: longUrl}});
121
        request.execute(function (resp) {
122
            if (resp.error) {
123
                $('#linkDialogError').html('Error: ' + resp.error.message);
124
            } else {
125
                $('#linkDialogLink').val(resp.id);
126
                $('#linkDialogLink').select();
127
            }
128
        });
129
    });
130
}
131
132
133
/* setup button events */
134
$(document).ready(function () {
135
    'use strict';
136
137
    $("#sidebartoggle").click(function () {
138
        if ($('#sidebar').is(':visible')) {
139
            Sidebar.hide();
140
        } else {
141
            Sidebar.show();
142
        }
143
    });
144
    $('#buttonWhereAmI').click(function () {
145
        Geolocation.whereAmI(true);
146
    });
147
    $("#hillshading").click(function () {
148
        Hillshading.toggle($('#hillshading').is(':checked'));
149
    });
150
    $("#npa").click(function () {
151
        NPA.toggle($('#npa').is(':checked'));
152
    });
153
    $("#cdda").click(function () {
154
        CDDA.toggle($('#cdda').is(':checked'));
155
    });
156
    $("#geocaches").click(function () {
157
        Okapi.toggle($('#geocaches').is(':checked'));
158
    });
159
    $('#coordinatesFormat').change(function () {
160
        setCoordinatesFormat($('#coordinatesFormat').val());
161
    });
162
    $("#freifunk").click(function () {
163
        Freifunk.toggle($('#freifunk').is(':checked'));
164
    });
165
    $("#buttonUploadGPX").click(function (e) {
166
        $("#buttonUploadGPXinput").click();
167
        e.preventDefault();
168
    });
169
    $("#buttonExportGPX").click(function () {
170
        DownloadGPX.initiateDownload();
171
    });
172
    $("#buttonMulticoordinates").click(function () {
173
        showMulticoordinatesDialog();
174
    });
175
});
176
177
/* react on resizes */
178
var onResize = function () {
179
    'use strict';
180
    var h = $("#main-navbar").outerHeight();
181
    $("#map-wrapper").css("top", h);
182
    $("#sidebar").css("top", h);
183
};
184
$(window).resize(onResize);
185
$(function () {
186
    'use strict';
187
    onResize();
188
});
189